package com.brave;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ProjectName:wenna-web-srv
 * @PackageName:com.wenna.config
 * @UserName: BraveKing-wy
 * @DateTime:2019/1/5 10:21
 * @Description:
 **/
@Component
@Configuration
@EnableSwagger2
public class SwaggerConfiguration
{
    @Bean
    public Docket createRestApi()
    {
        return (new Docket(DocumentationType.SWAGGER_2))
                .apiInfo(this.apiInfo())
                .select().apis(RequestHandlerSelectors.basePackage("com.brave"))
                .paths(PathSelectors.any()).build();
    }

    private ApiInfo apiInfo()
    {
        return (new ApiInfoBuilder()).title("有闲APP-服务端接口文档").description("山东单纯信息科技有限公司 ").termsOfServiceUrl("").version("v1.0").build();
    }
}